﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ERP.Manager.DataProvider;
using ERP.Manager.DataEntity;

namespace ERP.Manager.BusinessServices
{
    public class MessageinfoServices
    {
        private readonly IMessageRepository messageRepository;

        public MessageinfoServices() { }
        public MessageinfoServices(IMessageRepository messagerepository)
        {
            this.messageRepository = messagerepository;
        }

        #region 查询所有公告信息的方法
        public List<Messageinfo> getAllMessages(int pagecount)
        {
            return messageRepository.getAllMessages(pagecount);
        }
        #endregion

        #region 欢迎首页用
        public List<Messageinfo> getMessagesToIndex()
        {
            return messageRepository.getMessagesToIndex();
        }
        #endregion

        #region 添加公告信息的方法
        public int AddMessage(Messageinfo message)
        {
            return messageRepository.AddMessage(message);
        }
        #endregion

        #region 删除公告信息的方法
        public int DeleteMessage(int messageId)
        {
            return messageRepository.DeleteMessage(messageId);
        }
        #endregion

        #region 查询公告信息的详细信息
        public Messageinfo AllMessageDetail(Messageinfo message)
        {
            return messageRepository.AllMessageDetail(message);
        }
        #endregion

        #region 修改公告信息的方法
        public int UpdateMessage(Messageinfo message)
        {
            return messageRepository.UpdateMessage(message);
        }
        #endregion

        #region 得到所有公告条数信息的方法
        public int getAllMessageCount()
        {
            return messageRepository.getAllMessageCount();
        }
        #endregion

        #region 根据用户编号查询公告信息
        public List<Messageinfo> getallmessagefromuserid(string fromuserid)
        {
            return messageRepository.getallmessagefromuserid(fromuserid);
        }
        #endregion

        #region 根据用户编号删除公告信息
        public int deletemessagefromuserid(string fromuserid)
        {
            return messageRepository.deletemessagefromuserid(fromuserid);
        }
        #endregion
    }
}
